package com.qf.service.impl;

import com.qf.entity.NewsComment;
import com.qf.mapper.NewsCommentMapper;
import com.qf.service.NewsCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ASUS
 * @version V1.0
 * @Project work
 * @Package com.qf.service.impl
 * @Date 2021/10/5 13:41
 */
@Service
public class NewsCommentServiceImpl implements NewsCommentService {

    @Autowired
    private NewsCommentMapper newsCommentMapper;

    @Override
    public void add(NewsComment newsComment) {
        int i = newsCommentMapper.insertSelective(newsComment);
        if (i != 1) {
            throw new RuntimeException("添加失败");
        }
    }

    @Override
    public void delete(long news_id) {
        newsCommentMapper.delete(news_id);
    }

    @Override
    public List<NewsComment> findByNewId(long news_id) {
        return newsCommentMapper.findByNewId(news_id);
    }
}
